﻿using System;
using System.Collections.Generic;

using System.Windows;
using System.Windows.Controls;

using System.Windows.Input;
using System.Windows.Navigation;

using EagleJournal.Controls;

namespace EagleJournal
{
	public partial class DialogClients : UserControl
    {
        public static readonly  RoutedEvent
            InvokeDialogConfirmEvent = EventManager.RegisterRoutedEvent("InvokeDialogConfirm", RoutingStrategy.Direct, typeof(RoutedEventHandler), typeof(DialogClients));
        public event            RoutedEventHandler
            InvokeDialogConfirm
        {
            add     { this.AddHandler(InvokeDialogConfirmEvent, value); }
            remove  { this.RemoveHandler(InvokeDialogConfirmEvent, value); }
        }

		public DialogClients()
		{
			this.InitializeComponent();
		}

        private void ButtonClose_Click(object sender, RoutedEventArgs e)
        {
            this.RaiseEvent(new RoutedEventArgs(InvokeDialogConfirmEvent));
        }

        public void ClearData()
        {
            this.DataClients.Items.Clear();
        }
        public void PassData(List<ClientInformation> data)
        {
            foreach (ClientInformation cInfo in data)
            {
                ListClientInfo client = new ListClientInfo()
                {
                    Content = cInfo.Name,
                    ClientID = cInfo.ID,
                    ClientNotification = Convert.ToString(cInfo.Notifications)
                };

                this.DataClients.Items.Add(client);
            }
        }
	}
}